package demo2;

import java.util.*;

public class Test {
    public static void main(String[] args) {

    }

    public static void main3(String[] args) {
        Stack<Integer> stack1 = new Stack<>();//线性栈
        Queue<Integer> queue1 = new LinkedList<>();//队列的链式实现
        LinkedList<Integer> linkedList = new LinkedList<>();//双向链表
        Deque<Integer> deque1 = new ArrayDeque<>();//双端队列的线性实现
        Deque<Integer> deque2 = new LinkedList<>();//双端队列的链式实现
    }

    public static void main2(String[] args) {
        Queue<Integer> queue = new LinkedList<>();
        queue.offer(1);
        queue.offer(2);
        queue.offer(3);
        queue.offer(4);
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.peek());
        System.out.println(queue.poll());
        System.out.println(queue.size());
    }

    public static void main1(String[] args) {
        MyQueue myQueue = new MyQueue();
        myQueue.offer(1);
        myQueue.offer(2);
        myQueue.offer(3);
        myQueue.offer(4);
        System.out.println("1 2 3 4");
        System.out.println("size: " + myQueue.size());
        System.out.println("poll: " + myQueue.poll());
        System.out.println("peek: " + myQueue.peek());
        System.out.println("peek: " + myQueue.peek());
        System.out.println("size: " + myQueue.size());
        System.out.println("poll: " + myQueue.poll());
        System.out.println("poll: " + myQueue.poll());
        System.out.println("poll: " + myQueue.poll());
        System.out.println("size: " + myQueue.size());
        System.out.println("poll: " + myQueue.poll());
    }
}
